package com.caigou.modules.center.adapter

import android.text.TextUtils
import com.caigou.comm.base.utils.ImageLoader
import com.caigou.modules.center.R
import com.caigou.modules.center.bean.MyFollowItemBean
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @author #Suyghur.
 * Created on 2021/11/03
 */
class MyFollowAdapter(dataset: MutableList<MyFollowItemBean>) : BaseQuickAdapter<MyFollowItemBean, BaseViewHolder>(R.layout.item_my_follow_list, dataset),
    LoadMoreModule {

    init {
        addChildClickViewIds(R.id.item_my_follow_btn_cancel)
    }

    override fun convert(holder: BaseViewHolder, item: MyFollowItemBean) {
        holder.setText(R.id.item_my_follow_tv_nickname, item.nickName)
        if (!TextUtils.isEmpty(item.headImg)) {
            ImageLoader.loadCircle(context, item.headImg, holder.getView(R.id.item_my_follow_iv_avatar))
        } else {
            holder.setImageResource(R.id.item_my_follow_iv_avatar, R.drawable.img_comm_avatar)
        }
    }
}